package com.sxjh.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.sxjh.entity.Contract;
import com.sxjh.entity.param.ContractListParam;
import com.sxjh.entity.result.ContractListResult;
import com.sxjh.mapper.ContractMapper;
import com.sxjh.service.ContractService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 合同管理 服务实现类
 * </p>
 *
 * @author zixin
 * @since 2021-07-28
 */
@Service
public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> implements ContractService {

  @Autowired
  private ContractMapper contractMapper;

  @Override
  public IPage<ContractListResult> list(IPage<Void> iPage, ContractListParam param) {
    if (param.getContractKind()!=null){
      if (param.getContractKind()==1){
        return contractMapper.list1(iPage, param);
      }else {
        return contractMapper.list2(iPage, param);
      }
    }else{
      return contractMapper.list(iPage, param);
    }
  }

  @Override
  public boolean isJt(Integer id) {
    return contractMapper.isJt(id) != null ? true : false;
  }
}
